package com.hnichr.crm.common.customer.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 客户管理对象 crm_customer
 *
 * @author Cheng
 * @date 2022-11-22
 */
@Data
@Entity
@Table(name = "crm_customer")
@Schema(description = "客户管理")
public class CrmCustomer extends BaseEntity {

    /**
     * id
     */
    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;
    /**
     * 客户名称
     */
    @Schema(description = "客户名称")
    @Column(name = "customer_name", length = 255)
    private String customerName;
    /**
     * 客户类型
     */
    @Schema(description = "客户类型")
    @Column(name = "customer_type")
    @Dict(dicCode = "customer_type")
    private Integer customerType;

    /**
     * 客户级别
     */
    @Schema(description = "客户级别")
    @Column(name = "customer_level")
    @Dict(dicCode = "customer_level")
    private String customerLevel;

    /**
     * 跟进状态
     */
    @Schema(description = "跟进状态")
    @Column(name = "followup")
    private Integer followup;
    /**
     * 锁定
     */
    @Schema(description = "锁定")
    @Column(name = "is_lock")
    private Integer isLock;
    /**
     * 下次联系时间
     */
    @Schema(description = "下次联系时间")
    @Column(name = "next_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date nextTime;
    /**
     * 成交状态
     */
    @Schema(description = "成交状态")
    @Column(name = "deal_status")
    @Dict(dicCode = "deal_status")
    private Integer dealStatus;
    /**
     * 手机
     */
    @Schema(description = "手机")
    @Column(name = "mobile", length = 32)
    private String mobile;
    /**
     * 电话
     */
    @Schema(description = "电话")
    @Column(name = "telephone", length = 32)
    private String telephone;
    /**
     * 网址
     */
    @Schema(description = "网址")
    @Column(name = "website")
    private String website;
    /**
     * 备注
     */
    @Schema(description = "备注")
    @Column(name = "remark", length = 500)
    private String remark;
    /**
     * 负责人ID
     */
    @Schema(description = "负责人ID")
    @Column(name = "owner_user_id", length = 64)
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String ownerUserId;
    /**
     * 只读权限
     */
    @Schema(description = "只读权限")
    @Column(name = "ro_user_id")
    private String roUserId;
    /**
     * 读写权限
     */
    @Schema(description = "读写权限")
    @Column(name = "rw_user_id")
    private String rwUserId;
    /**
     * 注册地址-省-市-区
     */
    @Schema(description = "注册地址-省-市-区")
    @Column(name = "address", length = 255)
    private String address;
    /**
     * 定位信息
     */
    @Schema(description = "定位信息")
    @Column(name = "location", length = 255)
    private String location;
    /**
     * 详细地址
     */
    @Schema(description = "详细地址")
    @Column(name = "detail_address", length = 255)
    private String detailAddress;
    /**
     * 地理位置经度
     */
    @Schema(description = "地理位置经度")
    @Column(name = "lng", length = 255)
    private String lng;
    /**
     * 地理位置维度
     */
    @Schema(description = "地理位置维度")
    @Column(name = "lat", length = 255)
    private String lat;
    /**
     * 批次 比如附件批次
     */
    @Schema(description = "批次 比如附件批次")
    @Column(name = "batch_id", length = 64)
    private String batchId;
    /**
     * 上一次联系内容
     */
    @Schema(description = "上一次联系内容")
    @Column(name = "last_content", length = 1024)
    private String lastContent;
    /**
     * 最新活动记录时间
     */
    @Schema(description = "最新活动记录时间")
    @Column(name = "last_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastTime;
    /**
     * 是否结单（按照开票来确定）
     */
    @Schema(description = "是否结单（按照开票来确定）")
    @Column(name = "statement")
    @Dict(dicCode = "statement")
    private Boolean statement = false;
    /**
     * 行业类型（国民行业分类）
     */
    @Schema(description = "行业类型")
    @Column(name = "industry_type")
    @Dict(dicCode = "industry_type")
    private String industryType;
    /**
     * 业务类型
     */
    @Schema(description = "业务类型")
    @Column(name = "business_type")
    @Dict(dicCode = "business_type")
    private String businessType;
    /**
     * 客户联系方式
     */
    @Schema(description = "客户联系方式")
    @Column(name = "contacts_info")
    private String contactsInfo;
    /**
     * 客户归属人
     */
    @Schema(description = "客户归属人")
    @Column(name = "belong_to")
    private String belongTo;
    /**
     * 归属人联系方式
     */
    @Schema(description = "归属人联系方式")
    @Column(name = "belong_info")
    private String belongInfo;
    /**
     * 纳税人识别号
     */
    @Schema(description = "纳税人识别号")
    @Column(name = "tax_id")
    private String taxId;
    /**
     * 所属公司
     */
    @Schema(description = "所属公司")
    @Column(name = "company")
    private String company;

}
